/*
*
*	Create by Tsihang
*	
*/
#include "rpcGloableTables.h"
#include "sysInfo.h"

int _RPCGetSysInfo()
{

	RPCDebugOut("Enter _RPCGetSysInfo\r\n");
	
	/*
	*	add your own code here
	*/
	return 1;
}

int _RPCGetSysInfo_IP()
{
    int sock_fd;
    int num = 0;
    struct ifreq ifr_ip;
    struct   sockaddr_in *sin;  

    if ((sock_fd=socket(AF_INET, SOCK_STREAM, 0)) == -1)  
    {  
         printf("socket create failse...GetLocalIp!/n");  
         return (-1);  
    }  
	
    memset(&ifr_ip, 0, sizeof(ifr_ip));  
    strncpy(ifr_ip.ifr_name, DEVICE_OF_NETWORK, sizeof(ifr_ip.ifr_name) - 1); 
#if 0
    if(ioctl(sock_fd, SIOCGIFADDR, &ifr_ip))     
    {    
	    sin = (struct sockaddr_in *)&ifr_ip.ifr_addr;
	    close(sock_fd);
	    printf("*******************************IP address : %d\n", sin->sin_addr.s_addr);
	    return (sin->sin_addr.s_addr);
    } 
    else
#endif
    {
	    int ip = 0;
	    ip = 115 << 24 | 1 << 16 | 168 << 8 | 192;
	    return ip;
     }

}
